﻿<div ng-controller="DirectsponsorController">
    <div class="row">
        <div class="col-lg-12 col-sm-12 col-xs-12">
            <div class="row">
                <div class="col-lg-8 col-sm-8 col-xs-8">

                    <div class="well with-header">
                        <div class="header bg-themeprimary">
                            Tree
                        </div>
                        <div class="body">
                            <div class="pull-right">
                                <button class="btn btn-sm" ng-click="ToAddUser(downline)">
                                    <i class="fa fa-user"></i> Add child for : <span>{{downline.UserName}}</span>
                                </button>
                            </div>
                            <div id="tree" ng-click="doLoadTree()"></div>
                            <div id="entrytree" ng-show="nottree">Not loadding Data Tree</div>
                            <div class="clearfix"></div>
                            <div class="note" style="margin-top:15px;">
                                <ul id="note" class="list-inline">
                                    <li><span class="active" style="display:inline-block;width:20px;height:10px;background-color:#5bc0de;"></span> Active</li>
                                    <li><span class="unactive" style="display:inline-block;width:20px;height:10px;background-color:#999999;"></span> UnActive</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4 col-sm-4 col-xs-4">
                    <div class="well with-header">
                        <div class="header bg-themeprimary">
                            Account Info
                        </div>
                        <div class="body" style="padding-left: 20px;border-left: 1px dotted;">
                            <ul class="list-unstyled">
                                <li><h5> User Name: {{Info.UserName}}</h5></li>
                                <li><h5> Full Name: {{Info.FullName}}</h5></li>
                                <li><h5> Total F1: {{Info.TotalF1}}</h5></li>
                                <!--<li><h5> Invest: Ƀ {{Info.Invest|number:8}}</h5></li>-->
                                <li><h5> Downline: {{Info.Downline}}</h5></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <!-- show information of user login -->
    <div class="row" ng-if="ShowAddForm">
        <!--<div class="col-lg-12 col-sm-12 col-xs-12" ng-if="!PinCheck">
            <span style="margin-left:15px;color:orangered"> You must be greater than 4 pin</span>
        </div>-->
        <div class="col-lg-12 col-sm-12 col-xs-12">
            <div class="well with-header">
                <div class="header bg-themeprimary">
                    Add New User
                </div>
                <div class="body">

                    <div class="row">
                        <div class="col-lg-6 col-sm-6 col-xs-12 col-md-offset-3" style="margin-left:0px">
                            <form name="simpleForm" method="post" ng-submit="submitForm(simpleForm.$valid)" class="form-horizontal bv-form" novalidate>
                                <alert type="{{AlertType}}" class="radius-bordered alert-shadowed" ng-if="messeger">
                                    {{messeger}}
                                </alert>
                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Sponsor</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="Sponsor" ng-model="UserNew.Sponsor" readonly />
                                        <p ng-show="simpleForm.UserAssign.Sponsor2.$invalid && !simpleForm.UserNew.Sponsor.$pristine" class="help-block">This field is required.</p>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Username</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="Username" ng-model="UserNew.UserName" name="username" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.username.$touched">
                                            <div ng-show="simpleForm.username.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Full Name</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="Full Name" ng-model="UserNew.HoTen" name="hoten" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.hoten.$touched">
                                            <div ng-show="simpleForm.hoten.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Password</label>
                                    <div class="col-sm-8">
                                        <input type="password" class="form-control" placeholder="Password" ng-model="UserNew.Password" name="password" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.password.$touched">
                                            <div ng-show="simpleForm.password.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Confirm Password</label>
                                    <div class="col-sm-8">
                                        <input type="password" class="form-control" placeholder="Confirm Password" ng-model="UserNew.Password2" name="repassword" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.repassword.$touched">
                                            <div ng-show="simpleForm.repassword.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Password Level 2</label>
                                    <div class="col-sm-8">
                                        <input type="password" class="form-control" placeholder="Password Level 2" ng-model="UserNew.SecondPassword" name="secondpass" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.secondpass.$touched">
                                            <div ng-show="simpleForm.secondpass.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Confirm Password Level 2</label>
                                    <div class="col-sm-8">
                                        <input type="password" class="form-control" placeholder="Confirm Password Level 2" ng-model="UserNew.ConfirmSecondPassword" name="resecondpass" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.resecondpass.$touched">
                                            <div ng-show="simpleForm.resecondpass.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">CMND</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="CMND" ng-model="UserNew.SoCMND" name="cmnd" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.cmnd.$touched">
                                            <div ng-show="simpleForm.cmnd.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.Email.$invalid && !simpleForm.Email.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Email</label>
                                    <div class="col-sm-8">
                                        <input type="email" class="form-control" placeholder="Email" ng-model="UserNew.Email" name="email" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.email.$touched">
                                            <div ng-show="simpleForm.email.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                            <div ng-show="simpleForm.email.$error.email" class="help-block" style="color:orangered !important;"> Not valid email!.</div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.tel.$invalid && !simpleForm.tel.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Phone</label>
                                    <div class="col-sm-8">
                                        <input type="tel" class="form-control" placeholder="Phone" ng-model="UserNew.SDTNHARIENG" name="phone" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.phone.$touched">
                                            <div ng-show="simpleForm.phone.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group" ng-class="{ 'has-error' : simpleForm.required.$invalid && !simpleForm.required.$pristine }">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Bank Number</label>
                                    <div class="col-sm-8">
                                        <input type="tel" class="form-control" placeholder="Account Number" ng-model="UserNew.NganHang" name="banknumber" required />
                                        <div ng-show="simpleForm.$submitted || simpleForm.banknumber.$touched">
                                            <div ng-show="simpleForm.banknumber.$error.required" class="help-block" style="color:orangered !important;">This field is required.</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputEmail3" class="col-sm-3 control-label no-padding-right">Bank Type</label>
                                    <div class="col-sm-8">
                                        <ui-select ng-model="bank.selected">
                                            <ui-select-match placeholder="Select or search a Bank in the list...">
                                                {{$select.selected.Name}}
                                            </ui-select-match>
                                            <ui-select-choices repeat="item in BankList | filter: $select.search">
                                                <span ng-bind="item.Name"></span>
                                            </ui-select-choices>
                                        </ui-select>
                                    </div>
                                    {{UserNew.BankId=bank.selected.Id;""}}
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-8 col-sm-offset-3">
                                        <button class="btn btn-primary" ng-click="SaveUser(UserNew)" ng-disabled="progress">
                                            Save User
                                        </button>
                                        <span ng-show="progress" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
                                    </div>
                                </div>


                            </form>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <!-- end information of user login -->
    <!--Success Modal Templates-->
    <script type="text/ng-template" id="WarningModal">
        <div class="modal-header">
            <i class="glyphicon glyphicon-exclamation-sign"></i>
        </div>
        <div class="modal-title">{{title}}</div>
        <div class="modal-body">
            {{messeger}}
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-success" ng-click="ok()">OK</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
</div>
